/*
 * @Autor: PK
 * @Date: 2021-03-31 13:34:14
 * @Description: 唯一字符串id生成器，没有用
 */
using System;

namespace ShkSimulation.core.util{
    [Memento]
    public class IdentifyGenerator{
        private static long index;
        private static Object lockItem = new Object();
        internal static string GenerateIdentify(){
            long i = 1;
            byte[] bytes = Guid.NewGuid().ToByteArray();
            foreach (byte b in bytes){
                i *= (b + 1);
            }
            return string.Format("{0:x}", i - DateTime.Now.Ticks);
        }
        internal static long GenerateSortedIndex(){
            lock (lockItem){
                return ++index;
            }
        }
        internal static string GenerateIdentif2y(){
            Guid guid = Guid.NewGuid();
            return guid.ToString();
        }
        internal static long GenerateId(){
            byte[] buffer = Guid.NewGuid().ToByteArray();
            return BitConverter.ToInt64(buffer, 0);
        }
    }
}
